local skel= fk.CreateSkill({
    name = "history__zhenyi",
  })
  
  Fk:loadTranslationTable{
    ["history__zhenyi"] = "真仪",
    [":history__zhenyi"] = [[有角色于其回合内使用第一张非装备牌时，你可以移去一种记录的花色获得对应效果：
    <br><font color='red'>♥</font>：此牌目标+1或-1;
    <br><font color='red'>♦</font>：此牌伤害+1或-1;
    <br>♠：之后其本回合使用此花色的牌时摸一张牌或不能使用此花色的牌；
    <br>♣：此牌结算两次或无效。]],

    ["#history__zhenyi-choice"] = "真仪：选择移去一种记录的花色获得对应效果",

    ["#history__zhenyi-heart_add"] = "目标+1",
    ["#history__zhenyi-heart_sub"] = "目标-1",
    ["#history__zhenyi-diamond_add"] = "伤害+1",
    ["#history__zhenyi-diamond_sub"] = "伤害-1",
    ["#history__zhenyi-spade_add"] = "本回合使用此花色的牌时摸一张牌",
    ["#history__zhenyi-spade_sub"] = "本回合不能使用此花色的牌",
    ["#history__zhenyi-club_add"] = "结算两次",
    ["#history__zhenyi-club_sub"] = "此牌失效",

    ["@zhenyi-spade_add-turn"]="真仪摸牌",
    ["@zhenyi-spade_sub-turn"]="真仪禁止",

    ["#history__zhenyi-change-targets"] = "真仪：可以为此牌增加一个目标或减少一个目标",


  }

skel:addEffect(fk.CardUsing, {
  anim_type = "offensive",
  can_trigger = function(self, event, target, player, data)
    if player:hasSkill(skel.name) and target and 
      target.phase ~= Player.NotActive and data.card.type ~= Card.TypeEquip and target:getMark("zhenyi-turn")==0 then
        local suits = player:getTableMark("@history__falu")
        return #suits>0
    end
  end,
  on_cost = function(self, event, target, player, data)
    local room = player.room
    local ch={}
    local suits=player:getTableMark("@history__falu")
    if table.contains(suits,"log_diamond") and not data.card.is_damage_card then
      table.removeOne(suits,"log_diamond")
    end
    table.insertTable(ch,suits)
    table.insert(ch,"Cancel")
    if #suits>0 then
      local ret=room:askToChoice(player, {
        skill_name = skel.name,
        choices=ch,
        prompt = "#history__zhenyi-choice",
    })
    if ret and ret~="Cancel" then
      event:setCostData(self,ret)
      return true
    end
    end
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local ret=event:getCostData(self)
    local suits=player:getTableMark("@history__falu")
    table.removeOne(suits,ret)
    room:setPlayerMark(player, "@history__falu", suits)
    room:setPlayerMark(target, "zhenyi-turn", 1)
    if ret=="log_diamond" then--方块伤害+1/-1
      local ret=room:askToChoice(player, {
        skill_name = skel.name,
        choices={"#history__zhenyi-diamond_add","#history__zhenyi-diamond_sub"},
        prompt = "#history__zhenyi-choice",
    })
      if ret=="#history__zhenyi-diamond_add" then--方块伤害+1
        data.additionalDamage=(data.additionalDamage or 0)+1
      elseif ret=="#history__zhenyi-diamond_sub" then--方块伤害-1
        data.additionalDamage=(data.additionalDamage or 0)-1
      end
    elseif ret=="log_heart" then--红桃目标+1/-1
      local targets = data:getExtraTargets()
      local origin_targets = data.tos
      if #origin_targets > 0 then
        table.insertTable(targets, origin_targets)
      end
      local to = room:askToChoosePlayers(player, {
        min_num = 1,
        max_num = 1,
        targets = targets,
        skill_name = skel.name,
        prompt = "#history__zhenyi-change-targets",
        cancelable = false,
        extra_data = table.map(targets, Util.IdMapper),
        target_tip_name = "addandcanceltarget_tip",
      })
      if #to==0 then
        return
      end
      if table.contains(data.tos, to[1]) then
        data:removeTarget(to[1])
      else
        data:addTarget(to[1])
      end
      
    elseif ret=="log_spade" then--黑桃本回合使用此花色的牌时摸一张牌或不能使用此花色的牌
      local ret=room:askToChoice(player, {
        skill_name = skel.name,
        choices={"#history__zhenyi-spade_add","#history__zhenyi-spade_sub"},
        prompt = "#history__zhenyi-choice",
    })
      if ret=="#history__zhenyi-spade_add" then--黑桃本回合使用此花色的牌时摸一张牌
        room:setPlayerMark(target, "@zhenyi-spade_add-turn", {data.card:getSuitString(true)})
      else--黑桃本回合不能使用此花色的牌
        room:setPlayerMark(target, "@zhenyi-spade_sub-turn", {data.card:getSuitString(true)})
      end
    elseif ret=="log_club" then--梅花结算两次或无效
     local ret=room:askToChoice(player, {
        skill_name = skel.name,
        choices={"#history__zhenyi-club_add","#history__zhenyi-club_sub"},
        prompt = "#history__zhenyi-choice",
    })
      if ret=="#history__zhenyi-club_add" then--梅花结算两次
        data.additionalEffect=(data.additionalEffect or 0)+1
      elseif ret=="#history__zhenyi-club_sub" then--梅花无效
        data.toCard = nil
        data:removeAllTargets()
      end
    end
 
  end,
})


skel:addEffect("prohibit", {
  prohibit_func = function(self, from, skill, card, to, target_groups)
    
    if from and #from:getTableMark("@zhenyi-spade_sub-turn")~=0 and table.contains(from:getTableMark("@zhenyi-spade_sub-turn"),card:getSuitString(true)) then
      return true
    end
  
  end,
})


skel:addEffect(fk.CardUsing, {
  can_refresh = function(self, event, target, player, data)
    return player:hasSkill(skel.name) and #target:getTableMark("@zhenyi-spade_add-turn")~=0 and 
    table.contains(target:getTableMark("@zhenyi-spade_add-turn"),data.card:getSuitString(true))
  end,
  on_refresh = function(self, event, target, player, data)
    target:drawCards(1, skel.name)
  end,
})

  
  
  return skel